package com.zero.kafka.producer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MyProducer {

    private final static String TOPIC_NAME = "my-replicated-topic";

    @Autowired
    private KafkaTemplate kafkaTemplate;

    @RequestMapping(value = "/send",method = RequestMethod.GET)
    public void sendMsg(){
        kafkaTemplate.send(TOPIC_NAME,"key","send,this is a message");
    }
}
